<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>v-model的实现原理</title>
</head>
<body>
    <div id="app">
        <!-- 主要是inpute事件和v-bind的结合就能实现v-model -->
        <!-- <input type="text" :value="val" @input="changeInput"> -->
        <input type="text" :value="val" @input="e => val = e.target.value">
        <h3>{{val}}</h3>
    </div>
    <script src="../vue/vue.js"></script>
    <script>
        const app = new Vue({
            el:"#app",
            data:{
                val:''
            },
            methods: {
                changeInput(e){
                    this.val = e.target.value;
                }
            },
        });
    </script>
</body>
</html>